/*
 * Copyright (c) 2009. Silenus Consultoria, S.L.
 */
package es.silenus.detecta.model;

import java.io.Serializable;


/**
 * Survey unit answer imported id.
 *
 * @author <a href="mailto:malonso@silenus-consultoria.es">Mariano Alonso</a>
 *
 * @since 30-jun-2009 13:49:20
 */
public class SurveyUnitAnswerImportedId implements Serializable {
	/**
	 * The id header.
	 */
	private SurveyAnswerHeaderImported header;

	/**
	 * The question number.
	 */
	private Integer questionNumber;

/**
   * Constructor.
   */
	public SurveyUnitAnswerImportedId() {
	}

	/**
	 * Retrieves the header.
	 *
	 * @return the header.
	 */
	public SurveyAnswerHeaderImported getHeader() {
		return this.header;
	}

	/**
	 * Sets the header.
	 *
	 * @param header the header.
	 */
	public void setHeader(SurveyAnswerHeaderImported header) {
		this.header = header;
	}

	/**
	 * Retrieves the question number.
	 *
	 * @return the question number.
	 */
	public Integer getQuestionNumber() {
		return questionNumber;
	}

	/**
	 * Sets the question number.
	 *
	 * @param questionNumber the question number.
	 */
	public void setQuestionNumber(Integer questionNumber) {
		this.questionNumber = questionNumber;
	}

	/**
	 * Checks if objects are equal.
	 *
	 * @param o other object.
	 *
	 * @return true if equal, false otherwise.
	 */
	@Override
	public boolean equals(Object o) {
		if(this == o) {
			return true;
		}

		if((o == null) || (getClass() != o.getClass())) {
			return false;
		}

		SurveyUnitAnswerImportedId that = (SurveyUnitAnswerImportedId)o;

		if((getHeader() != null) ? (!getHeader().equals(that.getHeader())) : (that.getHeader() != null)) {
			return false;
		}

		if(
			(getQuestionNumber() != null) ? (!getQuestionNumber().equals(that.getQuestionNumber()))
																				: (that.getQuestionNumber() != null)) {
			return false;
		}

		return true;
	}

	/**
	 * Calculates the hash of this instance.
	 *
	 * @return the hash code.
	 */
	@Override
	public int hashCode() {
		int result = (getHeader() != null) ? getHeader().hashCode() : 0;

		result = (31 * result) + ((getQuestionNumber() != null) ? getQuestionNumber().hashCode() : 0);

		return result;
	}
}
